package horncomb.bpm.process.core;

import java.util.List;

/**
 * @author Daniel
 */
public interface ProcessDefinition {

	public ProcessInstance newInstance(Token parentToken, Object contextModel);

	/**
	 * 添加状态
	 * @param stateDef
	 */
	public void addState(StateDefinition stateDef);

	public StateDefinition findStateDefinition(String stateId);

	public boolean containsState(String stateId);

	/**
	 * 添加转变
	 * @param defaultTransition
	 */
	public void addTransition(Transition transition);

	/**
	 * @param transitionId
	 * @return
	 */
	public Transition findTransition(String transitionId);

	/**
	 * @return the startStateId
	 */
	public EnterableState getStartState();

	/**
	 * @return the id
	 */
	public String getId();

	public String getName();

	/**
	 * 获取状态允许的变化
	 * @param stateId
	 *            状态Id
	 * @return
	 */
	public List<Transition> findLeavingTransitions(String stateId);

	/**
	 * {@inheritDoc}
	 */
	public boolean hasLeavingTransitions(String stateId);
}